/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ch.repit.aglaja.client.contacts;

import ch.repit.rwt.client.BentoStatus;
import ch.repit.rwt.client.pdf.StickersPrintingPage;
import ch.repit.rwt.client.security.Action;
import ch.repit.rwt.client.security.Authorizer;
import ch.repit.rwt.client.security.SecurityManager;
import ch.repit.rwt.client.ui.CompositePage;
import ch.repit.rwt.client.ui.Page;

/**
 *
 * @author tc149752
 */
public class ContactsPage extends Page {


    public ContactsPage() {

    }

    
    @Override
    public void init() {
        setTitle("Contacts");

        addTab(new PersonsListTab(this, BentoStatus.ACTIVE));
       // addTab(new HouseholdsListTab(this));  // not interesting... a voir!
        addTab("Tags",new TagListPage(this, BentoStatus.ACTIVE, BentoStatus.ARCHIVE));

        Authorizer auth = SecurityManager.get().getAuthorizer();
        if (auth.isAllowed(Action.VIEW_TRASH, PersonDef.TYPE)
                || auth.isAllowed(Action.VIEW_TRASH, TagDef.TYPE))
            addTab(new ContactTrashPage(this,
                    new PersonsListTab(this, BentoStatus.TRASH),
                    auth.isAllowed(Action.VIEW_TRASH, TagDef.TYPE)?new TagListPage(this, BentoStatus.TRASH):null));
    }


    class ContactTrashPage extends CompositePage {
        ContactTrashPage(Page topPage, Page... composedPages) {
            super(topPage, "Trash",composedPages);
        }
    }

}
